package com.qcby.controller;

import com.qcby.Constants;
import com.qcby.model.dto.MovieARVo;
import com.qcby.model.resp.RespEntity;
import com.qcby.service.MovieActorRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class MovieActorRelationController {
    @Autowired
    private MovieActorRelationService movieARService;

    /**
     * 艺人查看详情 入参aid 根据艺人的aid查询出对应的出演电影  角色名   身份
     */
    @RequestMapping("/findMoveRole")
    public RespEntity<List<MovieARVo>> findMoveRole(Integer aid) {
        if (aid != null) {
            List<MovieARVo> list = movieARService.findMoveRole(aid);
            System.out.println(list);
            return RespEntity.successCustomize("", "", list);
        }
        return RespEntity.errorCustomize(Constants.FLAG_400, "参数为空", null);
    }
    /**
     * 电影查看详情 入参mid 根据电影的mid查询出对应的 艺人和角色名 身份
     */
    @RequestMapping("/findActorRole")
    public RespEntity<List<MovieARVo>> findActorRole(Integer mid){
        if(mid!=null){
            List<MovieARVo> list=movieARService.findActorRole(mid);
            System.out.println(list);
            return RespEntity.successCustomize("", "", list);
        }
        return RespEntity.errorCustomize(Constants.FLAG_400, "参数为空", null);
    }
}
